<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://localhost/" />
<title>Advanced Search Account</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Advanced Search Account</td></tr>
</thead><tbody>
<tr>
	<td>setTimeout</td>
	<td>45000</td>
	<td></td>
</tr>
<!--Go to accounts list-->
<tr>
	<td>open</td>
	<td>index.php/accounts/default</td>
	<td></td>
</tr>
<tr>
	<td>waitForPageToLoad</td>
	<td></td>
	<td></td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>assertTextPresent</td>
	<td>Create</td>
	<td></td>
</tr>
<tr>
	<td>assertTextPresent</td>
	<td>Update</td>
	<td></td>
</tr>
<tr>
	<td>assertTextPresent</td>
	<td>Export</td>
	<td></td>
</tr>
<tr>
	<td>assertTextPresent</td>
	<td>Delete</td>
	<td></td>
</tr>
<!--Test empty search-->
<tr>
	<td>waitForElementPresent</td>
	<td>id=more-search-link</td>
	<td></td>
</tr>
<tr>
	<td>click</td>
	<td>id=more-search-link</td>
	<td></td>
</tr>
<tr>
	<td>click</td>
	<td>id=addExtraAdvancedSearchRowButton-search-form</td>
	<td></td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=AccountsSearchForm_dynamicClauses_0_attributeIndexOrDerivedType</td>
	<td></td>
</tr>
<tr>
	<td>select</td>
	<td>id=AccountsSearchForm_dynamicClauses_0_attributeIndexOrDerivedType</td>
	<td>label=Website</td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=AccountsSearchForm_dynamicClauses_0_website</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>id=AccountsSearchForm_dynamicClauses_0_website</td>
	<td>NotExistingWebSiteInTheDataBase</td>
</tr>
<tr>
	<td>click</td>
	<td>css=#search-advanced-search &gt; span.z-label</td>
	<td></td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>assertTextPresent</td>
	<td>1 Criteria Selected</td>
	<td></td>
</tr>
<tr>
	<td>waitForTextPresent</td>
	<td>No results found</td>
	<td></td>
</tr>
<!--Test canceling search-->
<tr>
	<td>click</td>
	<td>id=clear-search-link</td>
	<td></td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>waitForTextPresent</td>
	<td>result(s)</td>
	<td></td>
</tr>
<tr>
	<td>waitForTextPresent</td>
	<td>Test Account ${randomSuffix}</td>
	<td></td>
</tr>
<!--Teste many clauses-->
<tr>
	<td>waitForElementPresent</td>
	<td>id=more-search-link</td>
	<td></td>
</tr>
<tr>
	<td>click</td>
	<td>id=more-search-link</td>
	<td></td>
</tr>
<tr>
	<td>click</td>
	<td>id=addExtraAdvancedSearchRowButton-search-form</td>
	<td></td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=AccountsSearchForm_dynamicClauses_0_attributeIndexOrDerivedType</td>
	<td></td>
</tr>
<tr>
	<td>select</td>
	<td>id=AccountsSearchForm_dynamicClauses_0_attributeIndexOrDerivedType</td>
	<td>label=Name</td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=AccountsSearchForm_dynamicClauses_0_name</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>id=AccountsSearchForm_dynamicClauses_0_name</td>
	<td>Test Account ${randomSuffix}</td>
</tr>
<tr>
	<td>click</td>
	<td>id=addExtraAdvancedSearchRowButton-search-form</td>
	<td></td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>select</td>
	<td>id=AccountsSearchForm_dynamicClauses_1_attributeIndexOrDerivedType</td>
	<td>label=Office Phone</td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=AccountsSearchForm_dynamicClauses_1_officePhone</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>id=AccountsSearchForm_dynamicClauses_1_officePhone</td>
	<td>456777</td>
</tr>
<tr>
	<td>click</td>
	<td>id=addExtraAdvancedSearchRowButton-search-form</td>
	<td></td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>select</td>
	<td>id=AccountsSearchForm_dynamicClauses_2_attributeIndexOrDerivedType</td>
	<td>label=Any Email Address</td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=AccountsSearchForm_dynamicClauses_2_anyEmail</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>id=AccountsSearchForm_dynamicClauses_2_anyEmail</td>
	<td>test2@testcompany.com</td>
</tr>
<tr>
	<td>click</td>
	<td>id=addExtraAdvancedSearchRowButton-search-form</td>
	<td></td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=AccountsSearchForm_dynamicClauses_3_attributeIndexOrDerivedType</td>
	<td></td>
</tr>
<tr>
	<td>select</td>
	<td>id=AccountsSearchForm_dynamicClauses_3_attributeIndexOrDerivedType</td>
	<td>label=Any Street</td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>waitForElementPresent</td>
	<td>id=AccountsSearchForm_dynamicClauses_3_anyStreet</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>id=AccountsSearchForm_dynamicClauses_3_anyStreet</td>
	<td>456 Main Street</td>
</tr>
<tr>
	<td>click</td>
	<td>css=#search-advanced-search &gt; span.z-label</td>
	<td></td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>waitForTextPresent</td>
	<td>Test Account ${randomSuffix}</td>
	<td></td>
</tr>
<tr>
	<td>assertTextPresent</td>
	<td>4 Criteria Selected</td>
	<td></td>
</tr>
<!--Test saving a search with no name-->
<tr>
	<td>open</td>
	<td>index.php/accounts/default</td>
	<td></td>
</tr>
<tr>
    <td>waitForPageToLoad</td>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>waitForCondition</td>
    <td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
    <td>30000</td>
</tr>
<tr>
	<td>click</td>
	<td>id=more-search-link</td>
	<td></td>
</tr>
<tr>
	<td>click</td>
	<td>id=save-as-advanced-search</td>
	<td></td>
</tr>
<tr>
	<td>click</td>
	<td>id=save-advanced-search</td>
	<td></td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>assertTextPresent</td>
	<td>Name cannot be blank.</td>
	<td></td>
</tr>
<!--Test invalid structure-->
<tr>
	<td>click</td>
	<td>id=show-dynamic-search-structure-div-link-search-form</td>
	<td></td>
</tr>
<tr>
	<td>type</td>
	<td>id=AccountsSearchForm_dynamicStructure</td>
	<td>1 or or 2 AND 3 AND 4</td>
</tr>
<tr>
	<td>click</td>
	<td>id=search-advanced-search</td>
	<td></td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
<tr>
	<td>waitForTextPresent</td>
	<td>The structure is invalid.</td>
	<td></td>
</tr>
<tr>
	<td>open</td>
	<td>index.php/accounts/default?clearingSearch=1</td>
	<td></td>
</tr>
<tr>
	<td>waitForPageToLoad</td>
	<td></td>
	<td></td>
</tr>
<tr>
	<td>waitForCondition</td>
	<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
	<td>30000</td>
</tr>
</tbody></table>
</body>
</html>
